home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Financial / Stopwatch2.3 / Source / AppIconView.m < prev    next >
Text File  |  1995-06-12  |  990b  |  47 lines

  1. /*
  2.  * For legal stuff see the file COPYRIGHT
  3.  */
  4. #import "AppIconView.h"
  5.  
  6. @implementation AppIconView
  7.  
  8.  
  9. /* Pass in a size and a subclass of View */
  10. - initFrame:(const NXRect *)frameRect sourceView:obj 
  11. {
  12.     [super initFrame:frameRect];
  13.      sourceWindow = [obj window];
  14.     [obj getFrame:&sourceRect];
  15.     return self;
  16. }
  17.     
  18. - drawSelf:(const NXRect *)rects :(int)count
  19. {
  20.     NXPoint    point = {9.0, 3.0};
  21.     id bitmap, image;
  22.     
  23. #ifdef ERASE_BACKGROUND
  24.     NXPoint    origin = {0.0, 0.0};
  25.     [[NXImage findImageNamed:"NXAppTile"] composite:NX_SOVER toPoint:&origin];
  26. #endif
  27.     
  28.     /* Read the bits from the window */
  29.     [[sourceWindow contentView] lockFocus];
  30.     bitmap = [[NXBitmapImageRep alloc] initData:NULL fromRect:&sourceRect];
  31.     [[sourceWindow contentView] unlockFocus];
  32.     [sourceWindow display];
  33.  
  34.     if (bitmap)
  35.     {
  36.         image=[[NXImage alloc] initSize:&sourceRect.size];        
  37.         [image useRepresentation:bitmap];
  38.         [image composite:NX_SOVER toPoint:&point];
  39.         [image free];
  40.     }
  41.     else
  42.         [bitmap free];
  43.     return self;
  44. }
  45.  
  46. @end
  47.